package nc.bs.pub.action;

import java.util.Hashtable;
import java.util.List;

import nc.bs.dao.BaseDAO;
import nc.bs.framework.common.NCLocator;
import nc.bs.pub.compiler.AbstractCompiler2;
import nc.itf.ic.m45.self.IPurchaseInMaintain;
import nc.jdbc.framework.processor.ColumnListProcessor;
import nc.jdbc.framework.processor.ColumnProcessor;
import nc.vo.ic.m45.entity.PurchaseInHeadVO;
import nc.vo.ic.m45.entity.PurchaseInVO;
import nc.vo.ml.NCLangRes4VoTransl;
import nc.vo.pub.BusinessException;
import nc.vo.pub.compiler.PfParameterVO;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;

public class N_45_CANCELSIGN extends AbstractCompiler2 {
	private Hashtable m_methodReturnHas = new Hashtable();
	private Hashtable m_keyHas = null;

	public Object runComClass(PfParameterVO vo) throws BusinessException {
		try {
			super.m_tmpVo = vo;
			PurchaseInVO[] inVOs = (PurchaseInVO[]) ((PurchaseInVO[]) this.getVos());
			PurchaseInHeadVO pvo=(PurchaseInHeadVO) inVOs[0].getParentVO();
			
			String sql="select cgeneralhid from   ic_material_b  where dr=0 and  csourcebillhid ='"+ pvo.getCgeneralhid()+"'";
		    List<String>  clp= (List<String>) new BaseDAO().executeQuery(sql, new ColumnListProcessor());
			if(!clp.isEmpty()) {
				throw new BusinessException("存在下游出料单，请删除后取消签字");
			}
			
			
			
			return ((IPurchaseInMaintain) NCLocator.getInstance().lookup(IPurchaseInMaintain.class)).cancelSign(inVOs);
		} catch (Exception var3) {
			ExceptionUtils.marsh(var3);
			return null;
		}
	}

	public String getCodeRemark() {
		return NCLangRes4VoTransl.getNCLangRes().getStrByID("4008002_0", "04008002-0076");
	}

	private void setParameter(String key, Object val) {
		if (this.m_keyHas == null) {
			this.m_keyHas = new Hashtable();
		}

		if (val != null) {
			this.m_keyHas.put(key, val);
		}

	}
}